#ifndef __DYNP_PACKET__
#define __DYNP_PACKET__

#include <arpa/inet.h>

#define ETHER_ADDR_LEN 6
#define MIN_TCP_HEADER_LEN 20
#define MIN_IP_HEADER_LEN 20
#define MAX_PACKET_SIZE  1504
#define IP_PACKET_TYPPE 0x800


struct ethernet_header
{
    unsigned char dst[ETHER_ADDR_LEN];
    unsigned char src[ETHER_ADDR_LEN];
    unsigned short type;
} ;

struct iphdr
{
    unsigned char res_vers;
    unsigned char tos;
    unsigned short total_len;
    unsigned short id;
    unsigned short fr_offset;
    unsigned char ttl;
    unsigned char protocol;
    unsigned short checkusum;
    unsigned int saddr;
    unsigned int daddr;
} ;

struct tcphdr
{
    unsigned short sport;
    unsigned short dport;
    unsigned int sno;
    unsigned int ano;
    unsigned short flagsetc;
    unsigned short wsz;
    unsigned short checksum;
    unsigned short ugptr;
} ;

struct udphdr
{
    unsigned short sport;
    unsigned short dport;
    unsigned short udp_length;
    unsigned short udp_checksum;

} ;

#define URGBIT 0x0020
#define ACKBIT 0x0010   
#define PSHBIT 0x0008
#define RSTBIT 0x0004
#define SYNBIT 0x0002
#define FINBIT 0x0001

struct Packet
{
    unsigned int _in_use;
    unsigned int _packet_size;
    unsigned char _data[MAX_PACKET_SIZE];
    Packet(unsigned int x = 0); 
    Packet(const Packet& x);
    void operator=(const Packet& x);
    bool operator==(const Packet& y);
    unsigned short getPacketType();
};

#endif 

